import Config from "@/utils/config";
import _axios from "@/plugins/axios";
class request {
    constructor() {
        if(localStorage.token){
            _axios.defaults.headers.common['Token'] = localStorage.token
        }
    }
    get({
        url = '',
        data = null
    }){
        return _axios.get(Config.bashUrl+url,{
            params:data
        })
    }
    post({
        url = '',
        data = null
    }) {
        // if (url != '/login') {
        //     this._setToken()
        // }
        return _axios.post(Config.bashUrl + url, data)
    }
    // _setToken() {
    //     if (localStorage.token) {
    //         _axios.defaults.headers.common['Token'] = localStorage.token
    //     }
    // }
}

// 导出request类
export default request